import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

const routers = [
  {
    path: '/',
    redirect: '/sort'
  },
  {
    path: '/login',
    name: 'login',
    meta: {
      title: '登录'
    },
    component: resolve => require(['@/views/login/login'], resolve)
  },
  {
    path: '/image-editor',
    name: 'ImageEditor',
    meta: {
      title: '图片编辑'
    },
    component: resolve => require(['@/views/editor/index'], resolve)
  },
  {
    path: '/sort',
    name: 'Sort',
    meta: {
      title: '拖拽排序'
    },
    component: resolve => require(['@/views/sort/index'], resolve)
  },
  {
    path: '/layout',
    name: 'layout',
    component: resolve => require(['@/layout/index'], resolve),
    children: [
      {
        path: '/index',
        name: 'index',
        meta: {
          title: '首页',
          keepAlive: true
        },
        component: resolve => require(['@/views/index/index'], resolve)
      }
    ],
    redirect: '/layout/index'
  }
]

export default new Router({
  mode: 'hash',
  routes: routers,
  base: '/mobile/'
})
